package model;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import common.Enums.Status;

/**
 * This class models a complete Business Case. 
 * All the business case data can be obtained through the navigation of each property. 
 * @author Raphael Rodrigues
 *
 */
public class BusinessCase 
{
	private UUID ID;
	private UUID solID;

	private String name;
	private String domain;
	private String subDomain;
	private String challenge;
	private String conclusion;
	private String decisionMaker;
	private String author;
	private String experts;
	private String perspective;
	private Date createdDate;
	private Date lastUpdated;
	
	private Solution solution;
	private Status status;

	private List<Process> processes;

	public BusinessCase()
	{
		ID = UUID.randomUUID();
		status = Status.NEW;
		createdDate = new Date();
		lastUpdated = new Date();
	}
	
	public BusinessCase(String name)
	{
		setName(name);
	}
	
	public BusinessCase(UUID ID)
	{
		this.ID = ID;
		status = Status.LOADED;
		createdDate = new Date();
		lastUpdated = new Date();
	}
	
	public UUID getSolID() {
		return solID;
	}

	public void setSolID(UUID solID) 
	{
		if(solID != this.solID)
			this.solID = solID;
	}
	
	public String getDecisionMaker() {
		return decisionMaker;
	}

	public void setDecisionMaker(String decisonMaker) 
	{
		this.decisionMaker = decisonMaker;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) 
	{
		this.author = author;
	}

	public String getExperts() {
		return experts;
	}

	public void setExperts(String experts) 
	{
		this.experts = experts;
	}

	public String getPerspective() {
		return perspective;
	}

	public void setPerspective(String perspective)
	{
		this.perspective = perspective;
	}
	
	/**
	 * Return the domain which the current business case is related to. 
	 * @return Business Case Domain
	 */
	public String getDomain() {
		return domain;
	}
	
	/**
	 * Set the domain value of the business case to the specified value in the parameter.
	 * @param domain Business Case Domain
	 */
	public void setDomain(String domain)
	{
		this.domain = domain;
	}
	
	/**
	 * Return the SubDomain which the current business case is related to. 
	 * @return Business Case SubDomain
	 */
	public String getSubDomain() {
		return subDomain;
	}
	
	/**
	 * Set the SubDomain value of the business case to the specified value in the parameter.
	 * @param domain Business Case SubDomain
	 */
	public void setSubDomain(String subDomain) 
	{
		this.subDomain = subDomain;
	}
	
	/**
	 * Return the textual description of the challenges that the business case has to deal with.
	 * @return Business Case SubDomain
	 */
	public String getChallenge() {
		return challenge;
	}
	
	/**
	 * Set the challenge value of the business case to the specified value in the parameter.
	 * @param challenge Business Case challenges
	 */
	public void setChallenge(String challenge)
	{
		this.challenge = challenge;
	}
	
	/**
	 * Returns the solution instance that is related to the Business Case. 
	 * @return Solution instance
	 * @see Solution
	 */
	public Solution getSolution() {
		return solution;
	}
	
	/**
	 * Set the solution instance which is related to the Business Case
	 * @param solution new solution instance
	 * @see Solution
	 */
	public void setSolution(Solution solution) {
		this.solution = solution;
	}
	
	/**
	 * Returns the list of processes that composes the Business Case
	 * @return List of Business case processes
	 */
	public List<Process> getProcesses() {
		return processes;
	}

	/**
	 * Sets the processes that are used in the Business Case 
	 * @param processes
	 */
	public void setProcesses(List<Process> processes) {
		this.processes = processes;
	}

	/**
	 * Returns the conclusion made upon this BC evaluation 
	 * @return BC Conclusion
	 */
	public String getConclusion() {
		return conclusion;
	}

	/**
	 * Sets the BC conclusion
	 * @param conclusion BC Conclusion
	 */
	public void setConclusion(String conclusion) {
		this.conclusion = conclusion;
	}
	
	/**
	 * Returns the ID for the current BC
	 * @return BC's ID
	 */
	public UUID getID() {
		return ID;
	}

	/**
	 * Returns the name of the BC
	 * @return BC's Name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name for the current BC
	 * @param name BC's Name
	 */
	public void setName(String name)
	{
		this.name = name;
	}
	
	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}
	
	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
	
	@Override
	public boolean equals(Object obj) 
	{
		boolean equals = false;
		
		if(obj.getClass() == this.getClass())
			equals = (ID.equals(((BusinessCase)obj).getID()));
		
		return equals;
			
	}
	
	@Override
	public int hashCode() 
	{
		return ID.hashCode();
	}
}
